<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8">
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<title>我的拍卖</title>
<script src="https://cdn.staticfile.org/vue/2.4.2/vue.min.js"></script>
<script src="https://cdn.staticfile.org/axios/0.18.0/axios.min.js"></script>
<link rel="icon" href="favicon.ico" type="image/ico">
<meta name="keywords" content="LightYear,光年,后台模板,后台管理系统,光年HTML模板">
<meta name="description"
	content="LightYear是一个基于Bootstrap v3.3.7的后台管理系统的HTML模板。">
<meta name="author" content="yinqi">
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/materialdesignicons.min.css" rel="stylesheet">
<link href="css/style.min.css" rel="stylesheet">
</head>

<body>
	<div class="container-fluid p-t-15">
		<div id="app">
			<table border="1px" class="table table-striped   text-center">
				<tr id="lovegoodsul" style="font-size: 14px" class="table-primary">
					<td class="jingpaili">序 号</td>
					<td class="jingpaili">商品名称</td>
					<td class="jingpaili">商品数量</td>
					<td class="jingpaili">商品上架价格</td>
					<td class="jingpaili">每一个加价价格</td>
					<td class="jingpaili">上架状态</td>
				</tr>

				<tr v-for="(goods,key) in goodes" class="table-primary">
					<td>{{key+1}}</td>
					<td>{{goods.name}}</td>
					<td>{{goods.num}}</td>
					<td>{{goods.starting_price}}</td>
					<td>{{goods.bid_increment}}</td>
					<td v-if="goods.audit_status===1">通过审核</td>
                                <td v-else>未通过审核</td>

				</tr>

			</table>
			<button @click="firstPage()">首页</button> &nbsp;&nbsp;&nbsp;&nbsp;
						<button @click="prePage(page)">上一页</button> &nbsp;&nbsp;&nbsp;&nbsp;
						<label id="currentPage" v-model='page'>1</label> &nbsp;&nbsp;&nbsp;&nbsp;
						<button @click="nextPage(page)">下一页</button> &nbsp;&nbsp;&nbsp;&nbsp;
						<button @click="lastPage(totalPages)">末页</button> &nbsp;&nbsp;&nbsp;&nbsp;
						跳到<input v-model="pages" type="text">
					<button @click="jumpPage(pages)">跳转</button>

		</div>




	</div>

	<script type="text/javascript">
	
	new Vue({
		el:"#app",
		data:{
			goodes:[],
			page:'',
			pages:'',
		 totalPages :'',
			
		},
		mounted(){
			axios.get('product/goodesByUid?page=1').then(res =>{
				this.goodes = res.data.data;
				
				this.page = 1;
				this.totalPages =res.data.totalPages; 
				console.info(res);
			})

		},
		methods:{
			firstPage:function(){
				window.location.reload();
			},
			prePage:function(page){
				
				page = page -1;
				alert(page);
				if(page<1){
					alert("已经是首页了")
					
				}else{
					axios.get('product/goodesByUid?page='+page).then(res =>{
						this.goodes = res.data.data;
						this.page = page;
						document.getElementById("currentPage").innerHTML = this.page; 
						console.info(this.goodes);
					})
				}
				
			},
			nextPage:function(page){
			
				page = page +1;
				alert(page);
				if(page>this.totalPages){
					alert("已经是最后一页了哦");
				}else{
					axios.get('product/goodesByUid?page='+page).then(res =>{
						this.goodes = res.data.data;
						this.page = page;
						document.getElementById("currentPage").innerHTML = this.page; 
						console.info(res);
					})
				}
	
			},
			lastPage:function(totalPages){
				
				this.page = totalPages;
				axios.get('product/goodesByUid?page='+this.page).then(res =>{
					this.goodes = res.data.data;
					document.getElementById("currentPage").innerHTML = this.page; 
					console.info(this.goodes);
				})
			},
			jumpPage:function(pages){
				
				this.page = pages;
				axios.get('product/goodesByUid?page='+this.page).then(res =>{
					this.goodes = res.data.data;
					document.getElementById("currentPage").innerHTML = this.page; 
					console.info(this.goodes);
				})
			}
		}
		
		
		
	})
	
	



</script>
	<script type="text/javascript" src="js/jquery.min.js"></script>
	<script type="text/javascript" src="js/bootstrap.min.js"></script>
	<script type="text/javascript" src="js/main.min.js"></script>
<html xmlns:th="http://www.thymeleaf.org"
	xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">

</body>
</html>